package com.moyuaninfo.repository;

import com.moyuaninfo.entity.MyyWaterQualityData;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

/**
 * @author 邱祥霸
 * @date 2020-04-08
 */
public interface MyyWaterQualityDataRepository extends JpaSpecificationExecutor<MyyWaterQualityData>, JpaRepository<MyyWaterQualityData, Long> {

    /**
     * 最新的一条数据
     *
     * @param equipmentWaterId 水质设备id
     * @return
     */
    @Query(value = "SELECT * FROM  myy_water_quality_data WHERE equipment_water_Id = ?1 Order by create_time DESC LIMIT 0, 1", nativeQuery = true)
    MyyWaterQualityData findMyyWaterQualityDataNew(Long equipmentWaterId);
}
